//
//  CommentModel.m
//  糗百——王桂敏
//
//  Created by 王桂敏 on 15/5/26.
//  Copyright (c) 2015年 lanouhn. All rights reserved.
//

#import "CommentModel.h"


@implementation CommentModel
- (id)initWithDictionary:(NSDictionary *)dictionary{
    self = [super init];
    if (self) {
        self.comment_id = dictionary[@"id"];
        self.content = dictionary[@"content"];
        self.floor = dictionary[@"floor"];
        self.user = [[[UserModel alloc] initWithDictionary:dictionary[@"user"]] autorelease];
    }
    return self;
}

- (CGRect)contentRect{
    CGRect targetRect = [self.content boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 50, 1000) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil];

    return targetRect;
}
- (CGFloat)rowHeight{
    CGFloat height = self.contentRect.size.height + 15 + 18;
    return height;
}

- (void)dealloc{
    [_comment_id release];
    [_floor release];
    [_content release];
    [_user release];
    [super dealloc];
}
@end
